package pers.qianyu.config;

import com.alibaba.druid.pool.*;
import io.seata.rm.datasource.*;
import org.springframework.boot.context.properties.*;
import org.springframework.context.annotation.*;

/**
 * Seata 数据源代理配置
 *
 * @author mizzle rain
 * @date 2020-10-16 14:45
 */
@Configuration
public class DataSourceProxyConfig {
    @Bean
    @ConfigurationProperties(prefix = "spring.datasource")
    public DruidDataSource druidDataSource() {
        return new DruidDataSource();
    }


    @Primary
    @Bean
    public DataSourceProxy dataSource(DruidDataSource druidDataSource) {
        return new DataSourceProxy(druidDataSource);
    }
}
